/**
 * 属性的封装
 * 
 * public 公共属性 可以被任何地方访问/修改
 * private 私有属性 只能在当前类中访问/修改 => 通过方法间接访问/修改 => 闭包
 * protected 受保护属性 只能在当前类和子类中访问/修改
 * readonly 只读属性 只能在声明时初始化，之后不能修改
 */
;(function(){

    class Person {
      public name: string;
      private age: number;
      protected gender: string;
      readonly birth: Date;

      constructor(name: string, age: number, gender: string, birth: Date) {
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.birth = birth;
      }

      getAge(): number {
        return this.age;
      }

    }

    let p = new Person('Alice', 25, 'female', new Date());
    

})()